IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetCOIReviewNote]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[GetCOIReviewNote]
GO

SET QUOTED_IDENTIFIER OFF
GO

/******************************************************************                
* Name:   [GetCOIReviewNote]                
* Purpose:  Gets the review Note for the COI  
* PARAMETERS(IN)                
* Name          Description                     
* -------------      -------------------------------------------                
* @cOIId int    COIId, to which the notes have to be obtained          
*********************************************************************/   
  
CREATE PROCEDURE dbo.[GetCOIReviewNote] --2  
(  
 @cOIId int   
 )  
AS BEGIN  
 If @cOIId <> 0  
  BEGIN  
   Select rn.Id , 
		  rn.[ReviewNote], 
		  rn.[DateCreated], 
		  rn.[DateModified]   
   From ReviewNote rn  
   Inner join COI_ReviewNote_Map crm  
	On rn.Id = crm.NoteId   
	where crm.COIId = @coiId  
  END  
END  
  
  